<template>
  <div>
    <h2>TsUser</h2>
    <p>
      用户
      <input type="text" :value="username" @input="$emit('update:username', $event.target.value)">
    </p>
    <p>
      邮箱
      <input type="text" :value="email" @input="$emit('update:email', $event.target.value)">
    </p>
    <p>
      手机
      <input type="text" :value="phone" @input="$emit('update:phone', $event.target.value)">
    </p>
  </div>
</template>
<script>
export default {
  props: {
    username: {
      type: String,
      required: true,
      validator(val) {
        return /^[a-z]{2,18}$/.test(val);
      }
    },
    phone: String,
    email: String
  }
}
</script>